
$("#loginbg2").hide();

var qymc=getQueryString2('qymc');
var xm=getQueryString2('xm');
getval();


function getval(){
	if(qymc!=null&&qymc!=''){
		$("#qymc").attr("value",qymc);
		getxyjl(1,'','','','','','','',qymc,'');
	}
		
	if(xm!=null&&xm!=''){
		$("#xm").attr("value",xm);
		
		$("#frclass").attr("class","TabbedPanelsTab");
		$("#frdiv").attr("class","TabbedPanelsContent ");
		$("#frdiv").attr("style","display: none;");
	
		$("#grdiv").attr("style","display: block;");
		$("#grdiv").attr("class","TabbedPanelsContent TabbedPanelsContentVisible");
		$("#grclass").attr("class","TabbedPanelsTab TabbedPanelsTabSelected");
		
		getxyjl(0,xm,'','','','','','','','');
	}
}


//获取URL参数数据
function getQueryString2(name) {
    var reg = new RegExp("(^|&)" + name + "=([^&]*)(&|$)", "i");
    var r = window.location.search.substr(1).match(reg);
    if (r != null) {
	    var xzjg2=decodeURI(decodeURI(r[2]));
	    return unescape(xzjg2); 
    }else{
    	return null;
    }
}

//点击查询事件
function submit2(objectType){
	
	var qymc=$("#qymc").val().replace(/\s/g, "");
	var zzjgdm=$("#zzjgdm").val().replace(/\s/g, "");
	var gszch=$("#gszch").val().replace(/\s/g, "");
	var tyshxydm=$("#tyshxydm").val().replace(/\s/g, "");
	var frdbxm='';
	var jqcz='';
	var yt='';
	var guanzhu='';
	var xm='';
	var sfzhm='';
	
		if(objectType==0){
			$("#gr").empty();
			var strnull='<tr><td colspan="5" align="center">查无结果...</td></tr>';
  			$("#gr").append(strnull);
  			alert("该功能暂未开通！");
			return;
			/*if(xm==null||xm==''){
				alert("姓名不能为空！");
			}else if(sfzhm==null||xm==''){
				alert("身份证号码不能为空！");
			}else {
				getxyjl(objectType,xm,sfzhm,'','','','','','','');
			}*/
		}else if(objectType==1){
			if(qymc==null||qymc==''){
				alert("企业名称不能为空！");
			}else {
				getxyjl(objectType,'','',zzjgdm,gszch,yt,frdbxm,jqcz,qymc,tyshxydm);
			}
		};
}
//请求滨州平台信息
function getxyjl(objectType,xm,sfzhm,zzjgdm,gszch,yt,frdbxm,jqcz,qymc,tyshxydm){
	$("#loginbg2").show();
	var url ='/web/SgsInterfaceAction.do?dispatch=getFrjbxx&page=1&rows=10'
	$.ajax({
		  type: "post",
		  url: "../httpsUtil/queryWfxy",
		  data:{
		  		'xm':encodeURI(encodeURI(xm)),
			  	'sfzhm':encodeURI(encodeURI(sfzhm)),
			  	'zzjgdm':encodeURI(encodeURI(zzjgdm)),
			  	'gszch':encodeURI(encodeURI(gszch)),
			  	'yt':encodeURI(encodeURI(yt)),
			  	'frdbxm':encodeURI(encodeURI(frdbxm)),
			  	'jqcz':encodeURI(encodeURI(jqcz)),
			  	'qymc':encodeURI(encodeURI(qymc)),
			  	'tyshxydm':encodeURI(encodeURI(tyshxydm)),
			  	'url':url
		  },
		  dataType: "json",
		  error:function(){
			 $("#loginbg2").hide();
		  },
		  success: function(data){
		  $("#fr").empty();
		  $("#gr").empty();
		  $("#loginbg2").hide();
		  	var list=data.rows;
		  	if(list==null||list.length==0){
		  		$("#fr").empty();
  				var strnull='<tr><td colspan="7" style="color: red;" align="center">查 无 结 果 . . . . . .</td></tr>';
  				$("#fr").append(strnull);
  				return;
		  		
		  	}
		  	var utilip = data.utilip;
		  	var str='';
		  	var sex='';
		  	var huji='';
		  	var dm='';
		  	$.each(list, function(index, vo){
		  		if(objectType==1){
		  			var num=index+1;
		  			str+="<tr><td>"+num+"</td><td>"+vo.qymc+"</td><td>"+vo.frdbxm+"</td><td>"+vo.zzjgdm+"</td> <td>"+vo.gszch+"</td><td>"+vo.dwlb+"</td>"
  				 +"<td ><a target='_blank' href='"+utilip+"/web/page/qy_zbpz_xyda.jsp?enterprise_id="+vo.enterprise_id+"&querytype=0&userid=admin&yt=12' > <span class='check'>查看</span></a></td></tr>";
		  		}else if(objectType==0){
		  			if(vo[2]=="1"){
		  				sex='男';
		  			}else if(vo[2]=="2"){
		  				sex='女';
		  			}else {
		  				sex='未知';
		  			}
		  			if(vo[4]=="0"){
		  				huji='在潍';
		  			}else if(vo[4]=="1"){
		  				huji='死亡';
		  			}else if(vo[4]=="2"){
		  				huji='迁出';
		  			}else{
		  				huji='在潍';
		  			}
		  			
		  		 str+="<tr><td>"+vo[1]+"</td><td>"+sex+"</td><td>"+vo[3]+"</td><td>"+huji+"</td>"
		  		 		+"<td><a target='_blank' href='"+utilip+"/web/page/qy_zbpz_xyda.jsp?enterprise_id="+vo[0]+"&querytype=1&userid=admin&yt=0'  ><span class='check'>查看</span></a></td></tr>";		  		
		  		}
		  	})
			if(objectType==1){
				$("#fr").append(str);
			}else if(objectType==0){
				$("#gr").append(str);
			}
		  }
	  })
}